/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package gui;

/**
 *
 * @author REX
 * Nota: El scroll no esta completamente implementado,
 * falta programar correctamente la parte en la que sube
 *
 */
public class FuncionalidadMenuCines {
    private int inicial;
    private int terminal;
    private int actual;
    private int scroll;
    private int visibles;
    private int scrollHeight;
    private int incremento = 0;
    public int getScrollHeight() {
        return scrollHeight;
    }

    public void setScrollHeight(int scrollHeight) {
        this.scrollHeight = scrollHeight;
    }
    
    public FuncionalidadMenuCines(int inicial, int terminal, int actual, int visibles) {
        this.inicial = inicial;
        this.terminal = terminal;
        this.actual = actual;
        this.visibles = visibles;
    }

    public FuncionalidadMenuCines(int inicial, int terminal, int actual, int scroll, int visibles) {
        this.inicial = inicial;
        this.terminal = terminal;
        this.actual = actual;
        this.scroll = scroll;
        this.visibles = visibles;
    }

    public int getVisibles() {
        return visibles;
    }

    public void setVisibles(int visibles) {
        this.visibles = visibles;
    }
    public int getFinal(){
        if(inicial + visibles >= terminal){
            return terminal;
        }
        return inicial + visibles;
    }


    public int getActual() {
        return actual;
    }

    public void setActual(int actual) {
        this.actual = actual;
    }

    public int getInicial() {
        return inicial;
    }

    public void setInicial(int inicial) {
        this.inicial = inicial;
    }

    public int getScroll() {
        return scroll;
    }

    public void setScroll(int scroll) {
        this.scroll = scroll;
    }

    public int getTerminal() {
        return terminal;
    }

    public void setTerminal(int terminal) {
        this.terminal = terminal;
    }
    public void subir(){
        if(actual == inicial){
            return;
        }
        if( (actual -1) <= inicial  && inicial - 1 >= 0 ){
            incremento -=scrollHeight;
            scroll -= incremento;
            
            inicial--;
            actual--;
            scroll -= scrollHeight*actual;
        }else{
           incremento-=scrollHeight;
            actual--;
        }
    }
    public void bajar(){
        if(actual == terminal){
          
    
            return;
        }
        if( (actual + 1) >= (getFinal() ) ){
          
            scroll += incremento;
            incremento+=scrollHeight;
            inicial++;
            actual++;
           
            return;
        }else{
            if(actual != 0)
                incremento+=scrollHeight;
            actual++;
        }
        
    }
    
}
